package com.revenco.bi.dao.nutz;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Condition;
import org.springframework.stereotype.Repository;

import com.revenco.bi.dao.TnTableInfoDao;
import com.revenco.bi.model.TnTableInfo;

/**
 * 
 * @author LingJun
 *
 */
@Repository
public class TnTableInfoDaoImpl extends AstractDaoImpl implements TnTableInfoDao {

	public List<TnTableInfo> getAll() {
		return this.getDao().query(TnTableInfo.class, null);
	}

	public List<TnTableInfo> getTableByName(String name) {
		Condition condition = Cnd.where("name", "=", name);
		return this.getDao().query(TnTableInfo.class, condition);
	}
	
	public String getTableNameById(String id) {
		Condition condition = Cnd.where("table_id", "=", id);
		return this.getDao().query(TnTableInfo.class, condition).get(0).getName();
	}
}
